package start;

import org.aspectj.lang.ProceedingJoinPoint;

public class Audience {
    public Audience() {
        System.out.println("Audience create..");
    }
    public  void takeSeats() {
        System.out.println("The audience is taking their seats.");
    }

    public void turnOffCellPhones() {
        System.out.println("The audience is turning off their cellphones");
    }

    public void applaud() {
        System.out.println("CLAP CLAP CLAP CLAP CLAP");
    }

    public void demandRefund() {
        System.out.println("Boo!We want our moneyback!");
    }
    
    public void watchPerformance(ProceedingJoinPoint joinpoint) {
        try {
            System.out.println("1. The audience is taking their seats.");
            System.out.println("2. The audience is turning off their cellphones");
            long start=System.currentTimeMillis();
            joinpoint.proceed();
            long end=System.currentTimeMillis();
            System.out.println("3. CLAP CLAP CLAP CLAP CLAP");
            System.out.println("4. The performance took "+(end-start) + " milliseconds.");            
        } catch (Throwable e) {
            System.out.println("5. Boo!We want our money back!");
        }
    }
}
